//
//  ByServiceForExperienceVC.m
//  mijifen_ios
//
//  Created by 朱凯 on 2017/12/11.
//  Copyright © 2017年 itboye. All rights reserved.
//

#import "ByServiceForPhysicalCheckVC.h"

// view
#import "ZKSegmentControl.h"

#import "ByViewPhysicalCheckBuy.h"
#import "ByViewPhysicalCheckAppointment.h"
#import "ByViewPhysicalCheckReport.h"

@interface ByServiceForPhysicalCheckVC ()

@property (nonatomic, strong) ZKSegmentControl *segment;

@end

@implementation ByServiceForPhysicalCheckVC

#pragma mark - 生命周期
- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = @"体检服务";
    
    [self addLeftBackBarButtonItem];
    
    [self createViews];
}
#pragma mark - 创建视图
- (void)createViews {
    
    _segment = [[ZKSegmentControl alloc] init];
    _segment.segmentHeight = @80;
    _segment.segmentSelectTint = rgba(149, 214, 250, 1);
    _segment.segmentSelectedViewWidthDynamically = @YES;
    _segment.segmentsArray = @[@"购买", @"预约", @"报告"];
    [self.view addSubview:_segment];
    [_segment mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view).insets(UIEdgeInsetsMake(0, 0, 0, 0)).priorityMedium();
        if (@available(iOS 11.0, *)) {
            make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-0);
            make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft);
            make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);
        }
    }];
    _segment.dynamicalAddContentViewBlock = ^(void (^contentViewFetchBlock)(ZKSegmentContentView *contentView), NSInteger selectedIndex) {
        ZKSegmentContentView *contentView;
        if (selectedIndex == 0) {
            contentView = [ByViewPhysicalCheckBuy new];
        } else if (selectedIndex == 1) {
            contentView = [ByViewPhysicalCheckAppointment new];
        } else {
            contentView = [ByViewPhysicalCheckReport new];
        }
        
        contentViewFetchBlock(contentView);
    };
    
}


@end
